<template>
  <div id="app">
    <nav class="navbar">
      <div class="nav-container">
        <div class="nav-logo">
          <h2>Vue3 优雅模板</h2>
        </div>
        <ul class="nav-menu">
          <li class="nav-item">
            <router-link to="/" class="nav-link" active-class="nav-link--active">首页</router-link>
          </li>
          <li class="nav-item">
            <router-link to="/about" class="nav-link" active-class="nav-link--active">关于</router-link>
          </li>
          <li class="nav-item">
            <router-link to="/contact" class="nav-link" active-class="nav-link--active">联系</router-link>
          </li>
        </ul>
      </div>
    </nav>
    <main class="main-content">
      <router-view />
    </main>
    <footer class="footer">
      <div class="footer-container">
        <p>&copy; 2023 Vue3 优雅模板. 保留所有权利.</p>
        <p class="footer-links">
          <a href="#">隐私政策</a> | 
          <a href="#">使用条款</a> | 
          <a href="#">帮助中心</a>
        </p>
      </div>
    </footer>
  </div>
</template>

<script>
import { defineAsyncComponent } from 'vue'

export default {
  name: 'App',
  components: {
    // 异步加载组件以提高性能
    AdvancedCard: defineAsyncComponent(() => import('./components/AdvancedCard.vue')),
    AdvancedButton: defineAsyncComponent(() => import('./components/AdvancedButton.vue')),
    AdvancedForm: defineAsyncComponent(() => import('./components/AdvancedForm.vue')),
    AdvancedFormItem: defineAsyncComponent(() => import('./components/AdvancedFormItem.vue')),
    AdvancedInput: defineAsyncComponent(() => import('./components/AdvancedInput.vue')),
    AdvancedAlert: defineAsyncComponent(() => import('./components/AdvancedAlert.vue')),
    AdvancedProgress: defineAsyncComponent(() => import('./components/AdvancedProgress.vue')),
    AdvancedModal: defineAsyncComponent(() => import('./components/AdvancedModal.vue'))
  }
}
</script>

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #f5f7fa 0%, #e4edf9 100%);
  min-height: 100vh;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.navbar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
}

.nav-logo h2 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 700;
  background: linear-gradient(to right, #fff, #f0f0f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-menu {
  display: flex;
  list-style: none;
}

.nav-item {
  margin-left: 1.5rem;
}

.nav-link {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s ease;
  padding: 0.6rem 1.2rem;
  border-radius: 30px;
  position: relative;
}

.nav-link:hover {
  color: white;
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.nav-link--active {
  color: white;
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.main-content {
  flex: 1;
  padding: 2.5rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.footer {
  background: linear-gradient(135deg, #2c3e50 0%, #1a2a3a 100%);
  color: rgba(255, 255, 255, 0.8);
  padding: 2rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.footer-links {
  display: flex;
  gap: 1rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: white;
  text-decoration: underline;
}

/* 组件基础样式 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.section {
  margin-bottom: 3rem;
  animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.section__title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2rem;
  color: #2c3e50;
  position: relative;
}

.section__title::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  margin: 0.8rem auto;
  border-radius: 2px;
}

.grid {
  display: grid;
  gap: 2rem;
}

.grid--2-cols {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3-cols {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 768px) {
  .nav-container {
    flex-direction: column;
    padding: 1rem;
  }
  
  .nav-menu {
    margin-top: 1rem;
  }
  
  .nav-item {
    margin: 0 0.5rem;
  }
  
  .main-content {
    padding: 1.5rem;
  }
  
  .grid--2-cols,
  .grid--3-cols {
    grid-template-columns: 1fr;
  }
  
  .section__title {
    font-size: 1.7rem;
  }
  
  .footer-container {
    text-align: center;
  }
  
  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .nav-logo h2 {
    font-size: 1.5rem;
  }
  
  .nav-link {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }
  
  .section__title {
    font-size: 1.5rem;
  }
}
</style>